#include <assert.h>
#include <Chance.h>
#include <stdio.h>
Chance::Chance(double probability):probability_m(probability)
{
    assert( 0 <= probability && probability <= 1 );
}

bool Chance::operator==(const Chance &chance) const
{
    double delta= probability_m - chance.probability_m;
    return (-EPSILON <= delta && delta <= EPSILON);
}

Chance Chance::operator!() 
{
    Chance chance(1 - probability_m);
    return chance;
}

Chance Chance::operator+(const Chance &chance ) const
{
    Chance newChance(probability_m + chance.probability_m - probability_m * chance.probability_m);
    return newChance;
}

Chance Chance::operator*(const Chance &chance ) const
{
   	Chance newChance( probability_m * chance.probability_m);
	return newChance;
}
